import '../utils/api.dart';

Future<bool> checkIfFollowing(String userId) async {
  final res = await Api.get('/profile/follow/$userId');
  // 你后端直接返回 true/false
  return res['data'] == true;
}

Future<void> followUser(String userId) async {
  final res = await Api.post('/profile/follow/$userId');
  if (res['code'] != 0) throw Exception('关注失败: ${res['msg']}');
}

Future<void> unfollowUser(String userId) async {
  final res = await Api.delete('/profile/follow/$userId');
  if (res['code'] != 0) throw Exception('取消关注失败: ${res['msg']}');
}
